const express = require("express");
const router = express.Router();

// 导入 Controller
const CategoryController = require("../controller/CategoryController");
const categoryController = new CategoryController();

// 引入认证中间件
const checkRoleMiddleware = require("../middleware/checkRoleMiddleware");

// 定义分类模块不同操作所需角色列表
const SUPPLIER_ROLES = {
  READ: [1, 2, 3], // 查看供应商：超管、库管、采购
};

// 获取分类列表
router.get("/", checkRoleMiddleware(SUPPLIER_ROLES.READ), (req, res) => {
  return categoryController.getCategoryList(req, res);
});

module.exports = router;
